package com.itheima.Jiuye06;

import java.time.LocalDateTime;

public class JDK8DeatDemo {
    public static void main(String[] args) {
        LocalDateTime dateTime = LocalDateTime.of(2021, 12, 11, 10, 07, 10);
        int year = dateTime.getYear();     //获取dateTime的年份
        System.out.println("年"+year);

        int month = dateTime.getMonthValue();  //获取月份
        System.out.println("月"+month);
        int dayOfMonth = dateTime.getDayOfMonth();//获取一个月中的第几天
        System.out.println("这是一个月中的第"+dayOfMonth+"天");
        int dayOfYear = dateTime.getDayOfYear();//获取这是一年中的第几天
        System.out.println(dayOfMonth);
    }
}
